/*******************************************************************/
/* @ All Rights Reserved Copyright (C) 2014 broada,Co.,Ltd.        */
/*                                                                 */
/*  NAME      = t_ora_add_closed_cursor.c                          */
/*  NOTE      =                                                    */
/*  DATE      = 2016/03/22 by geyh                                 */
/*******************************************************************/

#include <CUnit/Basic.h>
#include <stdlib.h>

#include "frcomm.h"
#include "frmem.h"

#include "../../../../src/module/oracle/config.h"
#include "../../test_ora_comm.h"
#include <apmtest_comm.h>
#include <oracle/comm/ora_stmt.h>
#include <frct_comm.h>
static int __suite_init(void)
{
    return 0;
}

static int __suite_cleanup(void)
{
    return 0;
}

static void __case1(void)
{

    Conntrack *p_st_conn = NULL;

    CU_ASSERT_EQUAL(test_ora_create_ct(&p_st_conn, TEST_ORA_SRC_IP, TEST_ORA_DST_IP, TEST_ORA_SRC_PORT, TEST_ORA_DST_PORT), FR_SUCC);

    L7_session *p_st_session = frct_get_session(p_st_conn);
    L7session_ora_private *p_st_session_private = (L7session_ora_private *) frct_get_session_private(p_st_session);
    L7session_ora *p_st_sess = p_st_session_private->p_st_sess;

    ora_add_closed_cursor(p_st_sess, 1);

    test_ora_destroy_ct(&p_st_conn);
    return;
}



int add_suite_ora_add_closed_cursor(void)
{
    CU_pSuite pSuite = NULL;

    if ((pSuite = CU_add_suite(MODULE_NAME" ora_add_closed_cursor()", __suite_init, __suite_cleanup)) == NULL)
        return FR_FAIL;

    CU_add_test(pSuite, "case1", __case1);

    return FR_SUCC;
}
